YAHOO.namespace('springmole');

(function () {
	
	
    /**
     *
     * @param {Object} el
     * @param {Object} userConfig
     */
    YAHOO.springmole.SQLDataPanel = function (el, userConfig) {
        YAHOO.springmole.SQLDataPanel.superclass.constructor.call(this, el, userConfig);
    };

	
    var Event = YAHOO.util.Event, 
		Dom = YAHOO.util.Dom, 

		ROOT_CLASS = 'sql-panel'; 

    
    YAHOO.lang.extend(YAHOO.springmole.SQLDataPanel, YAHOO.springmole.SpringMolePanel, {
		
		_paginator: null,
	
		CONFIG: {
        	'CONNECTION': {
            	key: 'connection'
        	}
    	},	
	
    
        init: function (el, userConfig) {
            YAHOO.springmole.SQLDataPanel.superclass.init.call(this, el, userConfig);
            
            Dom.addClass(this.innerElement, ROOT_CLASS);
        },
        
        
        initDefaultConfig: function () {
            YAHOO.springmole.SQLDataPanel.superclass.initDefaultConfig.call(this);
            
            this.cfg.addProperty(this.CONFIG.CONNECTION.key, {});
        },
        
        
        render: function (parentNode) {
            YAHOO.springmole.SQLDataPanel.superclass.render.call(this, parentNode);
            
            var paginatorId;
            
            paginatorId = Dom.generateId();
            
            this.setFooter('<div id="' + paginatorId + '"></div>');
            
            this._paginator = new YAHOO.widget.Paginator({
                rowsPerPage: 25,
                template: YAHOO.widget.Paginator.TEMPLATE_ROWS_PER_PAGE,
                rowsPerPageOptions: [10, 25, 50, 100],
                pageLinks: 5,
                containers: paginatorId
            });
            
        } // render 
    });
    
    
}());
